package com.yuexun.dhdoctor.module.Contract.model.impl;


import com.yuexun.dhdoctor.base.BaseEntity;
import com.yuexun.dhdoctor.module.Contract.api.CreateApi;
import com.yuexun.dhdoctor.module.Contract.bean.CreateGroup;
import com.yuexun.dhdoctor.module.Contract.bean.GoupExist;
import com.yuexun.dhdoctor.module.Contract.model.ICreateGroupModel;
import com.yuexun.dhdoctor.util.ApiUtil;

import java.util.Map;

import rx.Observable;

/**
 * Created by work-jx on 2016/7/25.
 */
public class CreateGroupModel implements ICreateGroupModel {
    private CreateApi api;

    public CreateApi ApiInstance() {
        if (api != null) {
            return api;
        } else {
            return ApiUtil.getInstance().createRetrofitApi(CreateApi.class);
        }
    }

    @Override
    public Observable<CreateGroup> createGroup(Map<String, String> praise) {
        api = ApiInstance();
        return api.createGroup(praise);
    }

    @Override
    public Observable<BaseEntity<GoupExist>> isGroupExisit(Map<String, String> praise) {
        api = ApiInstance();
        return api.isGroupExisit(praise);
    }

}
